using System;
using System.ComponentModel;
using System.Drawing;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	[Serializable()]
    [XmlType(TypeName = "BalloonStyleType")]
	public class BalloonStyle : ObjectType
	{
        private BackgroundColorNameChoiceEnum bgColorName;
        private KMLColor bgColorField, textColorField;
        private string textField;
        private displayModeEnum displayModeField;

        public BalloonStyle()
		{
            this.bgColorField = new KMLColor("ffffffff");
            this.textColorField = new KMLColor("ff000000");
            this.displayModeField = displayModeEnum.@default;
		}

        [XmlIgnore()]
        public BackgroundColorNameChoiceEnum BackgroundColorName
        {
            get { return this.bgColorName; }
            set { this.bgColorName = value; }
        }

        [XmlIgnore()]
        public Color BackgroundColor
        {
            get { return this.bgColorField.Color; }
            set { this.bgColorField = new KMLColor(value); }
        }

        [XmlIgnore()]
        public Color TextColor
        {
            get { return this.textColorField.Color; }
            set { this.textColorField = new KMLColor(value); }
        }

        [XmlIgnore()]
        public string TextColorString
        {
            get { return this.textColorField.ToString(); }
            set { this.textColorField = new KMLColor(value); }
        }

        [XmlElement(ElementName = "text", DataType = "string")]
        public string text
        {
            get { return this.textField; }
            set { this.textField = value; }
        }

        [XmlElement(ElementName = "displayMode", Type = typeof(displayModeEnum))]
        public displayModeEnum displayMode
        {
            get { return this.displayModeField; }
            set { this.displayModeField = value; }
        }

        [XmlElement(ElementName = "bgColor", DataType = "hexBinary", Type = typeof(byte[]))]
        [XmlElement(ElementName = "color", DataType = "hexBinary", Type = typeof(byte[]))]
        [XmlChoiceIdentifier(MemberName = "BackgroundColorName")]
        public byte[] BackgroundColorComponents
        {
            get { return this.bgColorField.ToByteArray(); }
            set { this.bgColorField = new KMLColor(value); }
        }

        [XmlElement(ElementName = "textColor", DataType = "hexBinary", Type = typeof(byte[]))]
        public byte[] TextColorComponents
        {
            get { return this.textColorField.ToByteArray(); }
            set { this.textColorField = new KMLColor(value); }
        }
    }
    public enum BackgroundColorNameChoiceEnum { bgColor, color }
    public enum displayModeEnum { @default, hide }
}